
<?php
$date = [
        "title" => $_POST['title'],
        "content" => $_POST['content']
];
$connect = new PDO('mysql:host=localhost; dbname=ajax22-23', 'root', '');
$sql = 'INSERT INTO `posts` (title, content) VALUES (:title, :content)';
$statment = $connect->prepare($sql);
$result = $statment->execute($date);

